<%@ CODEPAGE=65001 %>
<% Option Explicit %>
<% On Error Resume Next %>
<% Response.Charset="UTF-8" %>
<% Response.Buffer=True %>
<!-- #include file="../../c_option.asp" -->
<!-- #include file="../../function/c_function.asp" -->
<!-- #include file="../../function/c_function_md5.asp" -->
<!-- #include file="../../function/c_system_lib.asp" -->
<!-- #include file="../../function/c_system_base.asp" -->
<!-- #include file="../../function/c_system_event.asp" -->
<!-- #include file="../../function/c_system_plugin.asp" -->
<!-- #include file="../../plugin/p_config.asp" -->
<%

Call System_Initialize()

'检查非法链接
Call CheckReference("")

'检查权限
If BlogUser.Level>1 Then Call ShowError(6) 

If CheckPluginState("Totoro")=False Then Call ShowError(48)

	Dim i,j
	Dim s,t
	Dim aryArticle()
	s=Request.Form("edtBatch")
	
	If s<>"" Then
	
		t=Split(s,",")

		ReDim Preserve aryArticle(UBound(t))
		For j=0 To UBound(t)-1
			aryArticle(j)=0
		Next

		Dim objTrackBack
		Dim objArticle

		Set objArticle=New TArticle


		For i=0 To UBound(t)-1
			Set objTrackBack=New TTrackBack
			If objTrackBack.LoadInfobyID(t(i)) Then
				Dim objTestArticle
				Set objTestArticle=New TArticle
				objTrackBack.log_ID=-1-objTrackBack.log_ID
				If objTestArticle.LoadInfobyID(objTrackBack.log_ID) Then

					For j=0 To UBound(t)-1
						If aryArticle(j)=0 Then
							aryArticle(j)=objTrackBack.log_ID
						End If
						If aryArticle(j)=objTrackBack.log_ID Then Exit For
					Next

					If Not((objTestArticle.AuthorID=BlogUser.ID) Or (CheckRights("Root")=True)) Then Response.End
				Else
					'Call ShowError(9)
				End If
				Set objTestArticle=Nothing
				objTrackBack.Del
			End If
			Set objTrackBack=Nothing
		Next


		For j=0 To UBound(t)-1
			If aryArticle(j)>0 Then
				'Call BuildArticle(aryArticle(j),False,False)
			End If
		Next

		BlogReBuild_TrackBacks

	ElseIf request.QueryString("act")="delALL" Then

		Dim strSQL
		strSQL="WHERE ([log_ID]<0) "
		If CheckRights("Root")=False Then strSQL=strSQL & "AND( (SELECT [log_AuthorID] FROM [blog_Article] WHERE [blog_Article].[log_ID] =[blog_TrackBack].[log_ID] ) =" & BlogUser.ID & ")"
		
		objConn.Execute("DELETE FROM [blog_TrackBack] " & strSQL)
		
		BlogReBuild_TrackBacks
	
	End If
	
	Response.Redirect "setting2.asp"

%>
<%
Call System_Terminate()

If Err.Number<>0 then
  Call ShowError(0)
End If
%>